package com.mowwang.file;

import java.io.*;

public class Copy2 {
    public static void main(String[] args) {

        copyB();
    }


    public static void copyB(){
        FileReader reader=null;
        FileWriter writer=null;
        BufferedReader br=null;
        BufferedWriter bw=null;
        try {
            reader= new FileReader("src/com/mowwang/file/Find.java");
            br=new BufferedReader(reader);
            writer=new FileWriter("Find.java");
            bw=new BufferedWriter(writer);
            //int n=-1;//当什么时候不读？，当等于-1的时候
            String s=null;
           while ((s=br.readLine())!=null)
           { bw.write(s);
            bw.newLine();

           }
           bw.flush();//冲刷缓冲区
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                if (bw!=null)
                writer.close();
                if (br!=null)
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}